package com.demo.com.p_r_test;

import org.testng.annotations.Test;

/**
 * Desc: 测试主方法
 * @author: lisha 2018/7/4 15:08
 */
public class MainTest {

    @Test
    public void test_1(){
        String lock = new String("");
        P p=  new P(lock);
        C c=  new C(lock);

        ThreadP pThread = new ThreadP(p);
        ThreadC cThread = new ThreadC(c);

        pThread.start();
        cThread.start();
    }

    public static void main(String[] args) throws InterruptedException {

        String lock = new String("");
        P p = new P(lock);
        C r = new C(lock);

        ThreadP pThread = new ThreadP(p);
        ThreadC cThread = new ThreadC(r);

        pThread.start();
        Thread.sleep(1000);
        cThread.start();

    }
}
